<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <meta charset="utf-8">
    <title></title>
    <meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0">
    <!-- Loading Bootstrap -->
    <link href="Public/Admin/Flat/dist/css/vendor/bootstrap.min.css" rel="stylesheet">
    <!-- Loading Flat UI -->
    <link href="Public/Admin/Flat/dist/css/flat-ui.css" rel="stylesheet">
    <link rel="shortcut icon" href="Public/Admin/Flat/img/favicon.ico">
    <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
    <!--[if lt IE 9]>
    <script src="dist/js/vendor/html5shiv.js"></script>
    <script src="dist/js/vendor/respond.min.js"></script>
    <![endif]-->
    
    <!-- 气泡弹窗 -->
    <script type="text/javascript" src="Public/uploadify/jquery-1.8.2.min.js"></script>
    <link rel="stylesheet" type="text/css" href="<?php echo __PUBLIC__?>/Home/js/hdjs.css" />
    <script src="<?php echo __PUBLIC__?>/Home/js/hdjs.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
    <!-- 发送异步  判断角色名是否存在 -->
    <script type="text/javascript">
        $(function(){
            $('input[name=name]').change(function() {
                var _this=$(this)
                var name = $(this).val();
                $.ajax({
                    url: '<?php echo U('ajaxName')?>',
                    type: 'POST',
                    dataType: 'json',
                    data: {name: name},
                    success:function(arr){
                        if(!arr.status){
                            alert(arr.message);
                            _this.val('');
                        }
                    }
                })
            });
        })
    </script>
    <style type="text/css">
        .form-group{
            margin-bottom: 5px;
        }
        .form-group label{
            font-size: 16px;
            cursor: pointer;
        }
        .form-group label input{
            width: 15px;
            height: 15px;
        }
        .bigbox{
            border: 2px solid #bdc3c7;
            border-radius: 6px;
            margin-bottom: 10px;
            padding: 10px;
        }
    </style>
        <div class="alert alert-success">添加角色</div>
        <form action="" method="post" onsubmit="return hd_submit(this,'<?php echo U('Rbac/addrole')?>','<?php echo U('Rbac/authority',array('aid'=>Q('get.aid')))?>')">
            <div  class="form-group">
                <label for="rolename">角色名称：</label>
                <input class="form-control "  type="text" name="name" value="" required=""/>
            </div>
            <label for="rolename">角色权限：</label>
            <div class="bigbox">
                <?php foreach ($nodeData as $value){?>
                <div  class="form-group" onselectstart="return false" level="<?php echo $value['level']?>">
                    <label>
                        <?php echo $value['id']?>-<?php echo $value['_name']?>--<?php echo $value['title']?>
                        <?php if($value['level']==3){?>
                
                            <input type="checkbox" name="level3[]" value="<?php echo $value['id']?>" />
                        
               <?php }?>
                    </label>
                </div>
                <?php }?>
            </div>
            <input class="btn btn-primary btn-block" type="submit" value="确定权限角色" />
        </form>


</body>
</html>
